[codex] add session context to credential errors#3349
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Needs human review This PR modifies authentication session handling code (SessionStore.ts) to add context fields to error classes. Changes to auth-related code paths warrant human review regardless of the additive nature of the changes. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
87e3de9 to
9c8311a
Compare
Co-authored-by: codex <codex@users.noreply.github.com>
9c8311a to
308f5f4
Compare
Summary
Verification
vp test apps/server/src/auth/SessionStore.test.ts(8 tests)vp check(passes with 20 pre-existing warnings)vp run typecheckNote
Medium Risk
Touches session and WebSocket verification and revocation error paths in auth; behavior is largely additive structured fields with nested causes, but callers depending on old error shapes or broad
mapErrorwrappers could see different error tags.Overview
SessionStore auth failures now carry structured correlation fields instead of relying on generic messages alone.
Expiry, unknown-session, revocation, and invalid-
experrors for session and WebSocket tokens includesessionIdplus lifecycle timestamps (expiresAt/observedAtorrevokedAt). Internal paths—issue, verify, WebSocket issue/verify, revoke, and revoke-all-except—attachsessionId(orcurrentSessionId) on wrapper errors while nesting encoding and persistence failures ascause. Expiry checks useDateTime.nowrather than raw millisecond clock reads.Tests assert tagged error shapes and context fields (including repository failures on revoke) instead of substring checks on
message.Reviewed by Cursor Bugbot for commit 308f5f4. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add session context fields to credential and revocation errors in
SessionStoresessionId,expiresAt,observedAt,revokedAt, etc.) to all typed errors in SessionStore.ts, replacing bare string messages.Clock.currentTimeMillistoDateTime.nowfor expiry checks in both session and WebSocket token verification.SessionCredentialIssueError,SessionRevocationError,OtherSessionsRevocationError, etc.) with nested causes.Macroscope summarized 308f5f4.